//
//  List_ViewController.m
//  DA_V
//
//  Created by 中亿世联前台 on 15/4/21.
//  Copyright (c) 2015年 zhouhai. All rights reserved.
//

#import "List_ViewController.h"
#import "MyListTableViewCell.h"
#import "NoAffirmListTableViewCell.h"
#import "ZhiFu_SuccessdTableViewCell.h"
#import "MyShoppingList_ViewController.h"
#import "AddressViewController.h"
#import "List_ViewController.h"
#import "InterFace.h"
#import "ShipmentTableViewCell.h"

@interface List_ViewController ()<MyListTableViewCellDelegate>

@end

@implementation List_ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 30)];
    title.textAlignment = NSTextAlignmentCenter;
    title.font = [UIFont fontWithName:@"Helvetica-Bold" size:17];
    title.text = @"我的订单";
    title.textColor = [UIColor whiteColor];
    self.navigationItem.titleView = title;
    [self createTable];
}


- (void)createTable{
    self.myListTableView  =  [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    self.myListTableView.dataSource = self;
    self.myListTableView.delegate = self;
    [self.view addSubview:self.myListTableView];
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 1) {
        return 300;
    }
    if (indexPath.row == 2) {
        return 300;
    } else if(indexPath.row == 3)
    {
        return 300;
    }
    return 290;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    static NSString *indertStr = @"noZhiFuCell";
    MyListTableViewCell *nozhifuCell = [tableView dequeueReusableCellWithIdentifier:indertStr];
    if (nozhifuCell == nil) {
        nozhifuCell = [[MyListTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indertStr];
    }
    nozhifuCell.myListTableviewDelegate = self;
    
    static NSString *indertNoaffirmStr = @"noaffirmFuCell";
    NoAffirmListTableViewCell *noffirmCell = [tableView dequeueReusableCellWithIdentifier:indertNoaffirmStr];
    if (noffirmCell == nil) {
        noffirmCell = [[NoAffirmListTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indertNoaffirmStr];
    }
    
    static NSString *indertSuccessdStr = @"zhiFuSuccessdCell";
    ZhiFu_SuccessdTableViewCell *zhiFuSuccessd_Cell = [tableView dequeueReusableCellWithIdentifier:indertSuccessdStr];
    if (zhiFuSuccessd_Cell == nil) {
        zhiFuSuccessd_Cell = [[ZhiFu_SuccessdTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indertSuccessdStr];
    }
    
    static NSString *shipmentStr = @"shipmentCell";
    ShipmentTableViewCell *shipment_Cell = [tableView dequeueReusableCellWithIdentifier:shipmentStr];
    if (shipment_Cell == nil) {
        shipment_Cell = [[ShipmentTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:shipmentStr];
    }
    
    if (indexPath.row == 0) {
            return nozhifuCell;
    } else if (indexPath.row == 1){
        return noffirmCell;
    } else if(indexPath.row  == 2){
        return zhiFuSuccessd_Cell;
    } else
        return shipment_Cell;
}

#pragma -mark MylistTableViewCell点击去支付代理放过
- (void)goZhiFuShoppingInfo:(id)sender{
    AddressViewController *myShoppingCV = [[AddressViewController alloc] init];
    [self.navigationController pushViewController:myShoppingCV animated:YES];

}


@end
